﻿//-----------------------------------------------------------------------
// <copyright file="IDiagnosticsService.cs" company="CodePlex">
//     Copyright (c) Doug Holland, CodePlex. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace CodePlex.Diagnostics.Services
{
    using System;

    using System.Collections;
    using System.Collections.Generic;

    using System.Reflection;

    using System.Security;
    using System.Security.Principal;

    using System.ServiceModel;

    using System.Xml;
    using System.Xml.Linq;

    using CodePlex.Diagnostics.Contracts;

    /// <summary>
    /// Defines the service contract for the diagnostics service.
    /// </summary>
    [ServiceContract(Namespace = "http://www.codeplex.com/", ConfigurationName = "IDiagnosticsService")]
    public interface IDiagnosticsService
    {
        #region Guid PublishException(ExceptionDataContract contract, Dictionary<string, string> dictionary, XElement element, IIdentityDataContract identity)

        /// <summary>
        /// Publishes the exception information contained within the specified <see cref="T:CodePlex.Diagnostics.Contracts.ExceptionDataContract"/> to the database.
        /// </summary>
        /// <param name="contract">The <see cref="T:CodePlex.Diagnostics.Contracts.ExceptionDataContract"/> containing the exception information to be published to the database.</param>
        /// <param name="dictionary">A <see cref="T:System.Collections.Generic.Dictionary`2"/> containing name value pairs associated with this exception.</param>
        /// <param name="element">A <see cref="T:System.Xml.Linq.XElement"/> representing an xml element to be associated with this exception.</param>
        /// <param name="identity">The <see cref="T:CodePlex.Diagnostics.Contracts.IIdentityDataContract"/> containing the identity information to be published to the database.</param>
        /// <returns>A <see cref="T:System.Guid"/> representing the publication identifier for the specified <see cref="T:CodePlex.Diagnostics.Contracts.ExceptionDataContract"/> and <see cref="T:CodePlex.Diagnostics.Contracts.IIdentityDataContract"/>.</returns>
        [OperationContract]
        Guid PublishException(ExceptionDataContract contract, Dictionary<string, string> dictionary, XElement element, IIdentityDataContract identity);

        #endregion

        #region Guid Log(LogEntryDataContract contract, Dictionary<string, string> dictionary, XElement element, IIdentityDataContract identity)

        /// <summary>
        /// Writes the <see cref="T:System.String"/> using the configured logging provider.
        /// </summary>
        /// <param name="contract">The <see cref="T:CodePlex.Diagnostics.Contracts.LogEntryDataContract"/> containing the log entry information to be published to the database.</param>
        /// <param name="dictionary">A <see cref="T:System.Collections.Generic.Dictionary`2"/> containing name value pairs associated with this log entry.</param>
        /// <param name="element">A <see cref="T:System.Xml.Linq.XElement"/> representing an xml element to be associated with this log entry.</param>
        /// <param name="identity">The <see cref="T:CodePlex.Diagnostics.Contracts.IIdentityDataContract"/> containing the identity information to be published to the database.</param>
        /// <returns>A <see cref="T:System.Guid"/> representing the unique publication identifier for the log entry.</returns>
        [OperationContract]
        Guid Log(LogEntryDataContract contract, Dictionary<string, string> dictionary, XElement element, IIdentityDataContract identity);

        #endregion

        #region void UpdateProcessExitInformation(int processId, DateTime startTime, DateTime exitTime, int exitCode)

        /// <summary>
        /// Updates details about how and when the <see cref="T:System.Diagnostics.Process"/> exited within the CodePlex.Diagnostics database.
        /// </summary>
        /// <param name="processId">The process Id representing the <see cref="T:System.Diagnostics.Process"/> for which details about how and when it exited should be published.</param>
        /// <param name="startTime">The process start time.</param>
        /// <param name="exitTime">The process exit time.</param>
        /// <param name="exitCode">The process exit code.</param>
        [OperationContract]
        void UpdateProcessExitInformation(int processId, DateTime startTime, DateTime exitTime, int exitCode);

        #endregion

        #region void RegisterTeamFoundationServer(TeamFoundationServerDataContract contract)

        /// <summary>
        /// Registers the Team Foundation Server specified by the supplied <see cref="T:Uri"/> within the CodePlex.Diagnostics database.
        /// </summary>
        /// <param name="contract">The <see cref="T:CodePlex.Diagnostics.Contracts.TeamFoundationServerDataContract"/> representing the Team Foundation Server to be registered within the database.</param>
        [OperationContract]
        void RegisterTeamFoundationServer(TeamFoundationServerDataContract contract);

        #endregion
    }
}
